<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <link href="<%=basePath %>static/css/login.css" rel="stylesheet">
    <script src="<%=basePath %>static/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="<%=basePath %>static/layer-v3.0.3/layer/layer.js"></script>
</head>
<body>
<div id="login">
    <div style="height: 83px;margin-top: 32px;">
        <div style="font-size:28px;color:white;margin-left:400px;">郑州新郑国际机场</div>
        <div style="font-size:16px;color:white;margin-left:510px;">&nbsp;航空物流信息平台-报表分析系统</div>
    </div>
    <div class="login_box">
        <input class="admin" type="text" placeholder="请输入账号" id="userName" maxlength="30" />
        <input class="passWord" type="password" placeholder="请输入密码" id="password" maxlength="30" />
        <input class="submit" type="button" onclick="doLogin()"/>

        <div class="clear"></div>
    </div>
</div>
<div id="copyright"></div>
</body>
<script type="text/javascript">
    function doLogin(){
        var userName = $("#userName").val();
        var password = $("#password").val();

        if(userName==''){
            $("#userName").focus();
            layer.tips('请输入用户名', '#userName', {
                tips: [1, '#0FA6D8'] //还可配置颜色
            });
            //layer.open({content:"请输入用户名"});
            return false;
        }
        else if(password==''){
            $("#password").focus();
            layer.tips('请输入密码', '#password', {
                tips: [1, '#0FA6D8'] //还可配置颜色
            });
            return false;
        }
        else{
            jQuery.post("<%=basePath %>doLogin",{username:userName,password:password},function(result){
                if(result.status == 200){
                    sessionStorage.removeItem("menuid");
                    window.location.href="<%=basePath %>main";
                }else{
                    if(result.msg==1) {
                        $("#password").val("");
                        $("#userName").focus();
                        layer.tips('用户名或密码错误', '#userName', {
                            tips: [1, '#0FA6D8'] //还可配置颜色
                        });
                    }
                }
            },"json");
        }
    }
    $(function(){
        document.onkeydown = keyDown;
    });
    //回车登录事件
    function keyDown(){
        if (event.keyCode == 13){
            event.returnValue=false;
            event.cancel = true;
            doLogin();
        }
    }
</script>
</html>